RcometsAnalytics supports all cohort-specific analyses of the COMETS
consortium. This collaborative work is done via the COMETS harmonization
group activities. For more information, see the COMETS website.
This vignette demonstrates using the RcometsAnalytics R package from the
command line, while
the tutorial
demonstrates using RcometsAnalytics from the GUI. Documentation of the
RcometsAnalytics R package can be found here manual.
Each project could create their own vignette to run the analyses.
The required input file should be in excel format with the following 6 sheets:
Complete documentation of the various sheets can be found in the package documentation. An example input file is available HERE.
Only empty cells in any excel sheet become missing values when the R software reads the sheet into a data frame. Any non-numeric value in a cell for a continuous variable will result in an error.
The first step of the analysis is to load in the data with the
readCOMETSinput() function.
Input for this function is an Excel spreadsheet, per the description
above.
# Retrieve the full path of the input data
dir <- system.file("extdata", package="RcometsAnalytics", mustWork=TRUE)
csvfile <- file.path(dir, "cometsInputAge.xlsx")
# Read in and process the input data
exmetabdata <- RcometsAnalytics::readCOMETSinput(csvfile)
## VarMap sheet is read in.
## Metabolites sheet is read in.
## SubjectMetabolites sheet is read in.
## SubjectData sheet is read in.
## Models sheet is read in.
## Model_Types sheet is read in.
## There are 16 categorical variables.
## Running Integrity Check...
## Joining with `by = join_by(hmdb_id)`
## Begin testing models in Models sheet...
## Filtering subjects according to the rule(s) age< 70. 836 of 1000 are retained.
## Warning in runModel.addRemVars(rem.obj, vars[oneVal], vars.type, "too few
## unique non-missing values", : The variable(s) female, fasted have been removed
## from adjvars because of: too few unique non-missing values
## Warning in runModel.addRemVars(rem.obj, tmp[rem], varSet, "correlated with
## another predictor", : The variable(s) multivitamin.2 have been removed from
## adjvars because of: correlated with another predictor
## Finished testing models in Models sheet.
To plot some the distribution of variances for each metabolite:
RcometsAnalytics::plotVar(exmetabdata,titlesize=12)
## Warning: The titlefont attribute is deprecated. Use title = list(font = ...)
## instead.
To plot the distribution of minimum values:
RcometsAnalytics::plotMinvalues(exmetabdata,titlesize=12)
## Warning: The titlefont attribute is deprecated. Use title = list(font = ...)
## instead.
To plot the distribution of missing values:
RcometsAnalytics::plotMissvalues(exmetabdata,titlesize=12)
## Warning: The titlefont attribute is deprecated. Use title = list(font = ...)
## instead.
There are 2 ways to specify your model, batch or interactive. In Batch mode, models are specified in your input file Models sheet. The model information needs to be read in with the function getModelData() and processed so the software knows which models to run. The following call defines the “1 Age” model from the Models sheet in the input file to be run.
exmodeldata <- RcometsAnalytics::getModelData(exmetabdata,modlabel="1 Age")
In Interactive mode, models are specified as parameters. The model
information needs to be read in with the function
getModelData() and processed so the software knows which models
to run.
The following call defines the model with age and bmi_grp as the
exposure variables, and includes only the subjects with age > 40 and
bmi_grp > 2.
exmodeldata2 <- RcometsAnalytics::getModelData(exmetabdata, modelspec="Interactive",
exposures=c("age","bmi_grp"), where=c("age>40","bmi_grp>2"))
## Filtering subjects according to the rule(s) age>40 AND bmi_grp>2. 279 of 1000 are retained.
The runModel() function is the main function for running a single model, and by default, a correlation analysis is performed. The string “DPP” is a label for the cohort which will appear under the “cohort” column in the output.
excorrdata <- RcometsAnalytics::runModel(exmodeldata2,exmetabdata,"DPP")
The output of the correlation analysis can then be compiled and output to an Excel file with the following function:
RcometsAnalytics::OutputListToExcel(filename="DPP_corr.xlsx", excorrdata)
To view the first 3 lines of the correlation analysis output, simply type:
RcometsAnalytics::showModel(excorrdata,nlines=3)
##
## ModelSummary:
## run outcomespec exposurespec term nobs message adjvars
## 1 1 _1_2_3_benzenetriol_sulfate_2 age 279
## 2 2 _1_2_dipalmitoylglycerol age 279
## 3 3 _1_2_propanediol age 279
## adjvars.removed adjspec outcome_uid outcome
## 1 CHEM100006374 1,2,3-benzenetriol sulfate (2)
## 2 HMDB07098 DG(16:0/16:0/0:0)
## 3 HMDB01881 Propylene glycol
## exposure_uid exposure adj_uid metabolite_name
## 1 age Age at Entry 1,2,3-benzenetriol sulfate (2)
## 2 age Age at Entry 1,2-dipalmitoylglycerol
## 3 age Age at Entry 1,2-propanediol
##
## Effects:
## run outcomespec exposurespec term estimate pvalue
## 1 1 _1_2_3_benzenetriol_sulfate_2 age age 0.164624501 0.005846722
## 2 2 _1_2_dipalmitoylglycerol age age 0.068903188 0.251337451
## 3 3 _1_2_propanediol age age 0.001667259 0.977882521
## metabolite_name
## 1 1,2,3-benzenetriol sulfate (2)
## 2 1,2-dipalmitoylglycerol
## 3 1,2-propanediol
##
## Errors_Warnings:
## [1] type object message
## <0 rows> (or 0-length row.names)
##
## Table1:
## variable in.model type category n n.unique min quartile1 median
## 1 age exposure continuous 279 20 55 59 62
## 2 bmi_grp exposure categorical 3 269 NA NA NA NA
## 3 4 10 NA NA NA NA
## mean quartile3 max n.missing
## 1 62.68459 66 74 0
## 2 NA NA NA NA
## 3 NA NA NA NA
##
## Info:
## name value
## 1 date 2023-10-24 11:50:39.700485
## 2 cohort DPP
## 3 RcometsAnalytics version 2.9.0.13
## NULL
To display the heatmap of the resulting correlation matrix, use the showheatmap function.
RcometsAnalytics::showHeatmap(excorrdata)
To display the hierarchical clustering of the resulting correlation
matrix, use the showHClust function. This diplay requires at least 2
rows and 2 columns in the correlation matrix.
exmodeldata<-RcometsAnalytics::getModelData(exmetabdata,modelspec = "Interactive",exposures = c("bmi_grp","age"))
excorrdata <- RcometsAnalytics::runModel(exmodeldata,exmetabdata,"DPP")
RcometsAnalytics::showHClust(excorrdata, showticklabels=FALSE)
Results can be written to an output Excel file with the following command:
RcometsAnalytics::OutputListToExcel("Model1.xlsx", excorrdata)
A stratified correlation analysis can be performed by specifiying stratification variables in the call to getModelData(). If more than one stratification variable is specified, then the strata will be defined by all unique combinations of the stratification variables. The following call will define a model stratified by race_grp.
exmodeldata2 <- RcometsAnalytics::getModelData(exmetabdata,modelspec="Interactive",
outcomes=c("lactose","lactate"),
exposures=c("age","bmi_grp"),strvars="race_grp")
The stratified correlation analysis is run by calling the runModel() function.
excorrdata2 <- RcometsAnalytics::runModel(exmodeldata2,exmetabdata,"DPP")
Call getModelData() to define a model which adjusts for age group, has lactose and lactate as outcome variables, and has age and bmi group as the exposure variables.
exmodeldata <- RcometsAnalytics::getModelData(exmetabdata,modelspec="Interactive", adjvars="age_grp",
outcomes=c("lactose","lactate"), exposures=c("age","bmi_grp"))
To run a linear regression using the lm function, a list of options must be passed into runModel() with the model option set to “lm”.
lm_results <- RcometsAnalytics::runModel(exmodeldata, exmetabdata, "DPP", op=list(model="lm"))
print(lm_results)
## $ModelSummary
## run outcomespec exposurespec term wald.pvalue nobs message
## 1 1 lactose age age 0.16451267 1000
## 2 2 lactate age age 0.60149903 1000
## 3 3 lactose bmi_grp bmi_grp 0.02387982 1000
## 4 4 lactate bmi_grp bmi_grp 0.00166282 1000
## adjvars adjvars.removed
## 1 age_grp.2 age_grp.3
## 2 age_grp.2 age_grp.3
## 3 age_grp.2 age_grp.3
## 4 age_grp.2 age_grp.3
## exposure.covariances
## 1
## 2
## 3 1|bmi_grp.2,bmi_grp.3,bmi_grp.4|0.0092439068551822,0.00936698884111931,0.00922966495586578
## 4 1|bmi_grp.2,bmi_grp.3,bmi_grp.4|0.000234480159976484,0.000237602247228648,0.000234118901162175
## adjspec outcome_uid outcome exposure_uid exposure
## 1 age_grp HMDB00186 Alpha-Lactose age Age at Entry
## 2 age_grp HMDB00190 L-Lactic acid age Age at Entry
## 3 age_grp HMDB00186 Alpha-Lactose bmi_grp bmi_grp
## 4 age_grp HMDB00190 L-Lactic acid bmi_grp bmi_grp
## adj_uid metabolite_name
## 1 age_grp.2 age_grp.3 lactose
## 2 age_grp.2 age_grp.3 lactate
## 3 age_grp.2 age_grp.3 lactose
## 4 age_grp.2 age_grp.3 lactate
##
## $Effects
## run outcomespec exposurespec term estimate std.error statistic
## 1 1 lactose age age 0.034697534 0.024961296 1.3900534
## 2 2 lactate age age -0.002083854 0.003990177 -0.5222460
## 3 3 lactose bmi_grp bmi_grp.2 -0.047905160 0.134163189 -0.3570663
## 4 3 lactose bmi_grp bmi_grp.3 0.360610471 0.145954081 2.4707118
## 5 3 lactose bmi_grp bmi_grp.4 0.420224133 0.577141138 0.7281133
## 6 4 lactate bmi_grp bmi_grp.2 0.034207637 0.021367743 1.6009008
## 7 4 lactate bmi_grp bmi_grp.3 0.080743228 0.023245640 3.4734783
## 8 4 lactate bmi_grp bmi_grp.4 -0.126241151 0.091919426 -1.3733892
## pvalue estimate.lower estimate.upper metabolite_name
## 1 0.1648232433 -0.014225708 0.08362078 lactose
## 2 0.6016151626 -0.009904458 0.00573675 lactate
## 3 0.7211179261 -0.310860179 0.21504986 lactose
## 4 0.0136512756 0.074545728 0.64667521 lactose
## 5 0.4667157218 -0.710951712 1.55139998 lactose
## 6 0.1097166272 -0.007672369 0.07608764 lactate
## 7 0.0005359045 0.035182610 0.12630385 lactate
## 8 0.1699410577 -0.306399914 0.05391761 lactate
##
## $Errors_Warnings
## [1] type object message
## <0 rows> (or 0-length row.names)
##
## $Table1
## variable in.model type category n n.unique min quartile1 median
## 1 age exposure continuous 1000 20 55 59 63
## 2 bmi_grp exposure categorical 1 351 NA NA NA NA
## 3 2 370 NA NA NA NA
## 4 3 269 NA NA NA NA
## 5 4 10 NA NA NA NA
## 6 age_grp adjustment categorical 1 271 NA NA NA NA
## 7 2 565 NA NA NA NA
## 8 3 164 NA NA NA NA
## mean quartile3 max n.missing
## 1 63.208 67 74 0
## 2 NA NA NA NA
## 3 NA NA NA NA
## 4 NA NA NA NA
## 5 NA NA NA NA
## 6 NA NA NA NA
## 7 NA NA NA NA
## 8 NA NA NA NA
##
## $Info
## name
## 1 date
## 2 cohort
## 3 RcometsAnalytics version
## 4 R version
## 5 operating system
## 6 input file
## 7 model name
## 8 run type
## 9 op$check.cor.method
## 10 op$check.cor.cutoff
## 11 op$check.nsubjects
## 12 op$max.nstrata
## 13 op$model
## 14 op$output.Effects
## 15 op$output.ModelSummary
## 16 op$output.ci_alpha
## 17 op$output.metab.cols
## 18 op$output.type
## 19 op$output.merge
## 20 op$chemEnrich
## 21 op$chemEnrich.adjPvalue
## 22 op$max.npairwise
## 23 model.options$family
## 24 outcome
## 25 exposure
## 26 strata
## 27 exposurerefs
## value
## 1 2023-10-24 11:50:46.128675
## 2 DPP
## 3 2.9.0.13
## 4 R version 4.3.0 (2023-04-21)
## 5 Rocky Linux 8.7 (Green Obsidian)
## 6 /gpfs/gsfs10/users/wheelerwi/Rlibs/RcometsAnalytics/extdata/cometsInputAge.xlsx
## 7
## 8 Interactive
## 9 spearman
## 10 0.97
## 11 25
## 12 10
## 13 lm
## 14 exposure
## 15 anova
## 16 0.95
## 17 metabolite_name
## 18 xlsx
## 19 none
## 20 0
## 21 0.05
## 22 1000
## 23
## 24 *
## 25 *
## 26
## 27
##
## attr(,"ptime")
## [1] "Processing time: 0.345 sec"
## attr(,"class")
## [1] "runModel"
Run a linear regression using the glm function for the same variables as above. The default family used with glm is “gaussian”, which corresponds to a linear regression. The Effects data frame will be the same as with lm, but the ModelSummary data frame will contain some different columns.
glm_results <- RcometsAnalytics::runModel(exmodeldata, exmetabdata, "DPP", op=list(model="glm"))
print(all.equal(lm_results$Effects, glm_results$Effects))
## [1] TRUE
print(glm_results$ModelSummary)
## run outcomespec exposurespec converged term wald.pvalue nobs message
## 1 1 lactose age 1 age 0.16451267 1000
## 2 2 lactate age 1 age 0.60149903 1000
## 3 3 lactose bmi_grp 1 bmi_grp 0.02387982 1000
## 4 4 lactate bmi_grp 1 bmi_grp 0.00166282 1000
## adjvars adjvars.removed
## 1 age_grp.2 age_grp.3
## 2 age_grp.2 age_grp.3
## 3 age_grp.2 age_grp.3
## 4 age_grp.2 age_grp.3
## exposure.covariances
## 1
## 2
## 3 1|bmi_grp.2,bmi_grp.3,bmi_grp.4|0.0092439068551822,0.00936698884111931,0.00922966495586578
## 4 1|bmi_grp.2,bmi_grp.3,bmi_grp.4|0.000234480159976484,0.000237602247228648,0.000234118901162175
## adjspec outcome_uid outcome exposure_uid exposure
## 1 age_grp HMDB00186 Alpha-Lactose age Age at Entry
## 2 age_grp HMDB00190 L-Lactic acid age Age at Entry
## 3 age_grp HMDB00186 Alpha-Lactose bmi_grp bmi_grp
## 4 age_grp HMDB00190 L-Lactic acid bmi_grp bmi_grp
## adj_uid metabolite_name
## 1 age_grp.2 age_grp.3 lactose
## 2 age_grp.2 age_grp.3 lactate
## 3 age_grp.2 age_grp.3 lactose
## 4 age_grp.2 age_grp.3 lactate
Call getModelData() to define a model which adjusts for age group, has nested_case as the outcome variable, and has lactose and lactate as the exposure variables. The variable nested_case must be a binary 0-1 variable.
exmodeldata <- RcometsAnalytics::getModelData(exmetabdata,modelspec="Interactive", adjvars="age_grp",
outcomes="nested_case", exposures=c("lactose","lactate"))
To run a logistic regression, the list of options op must also include a model.options list with family set to “binomial”.
op <- list(model="glm", model.options=list(family="binomial"))
glm_results <- RcometsAnalytics::runModel(exmodeldata, exmetabdata, "DPP", op=op)
print(glm_results)
## $ModelSummary
## run outcomespec exposurespec converged term wald.pvalue nobs message
## 1 1 nested_case lactose 1 lactose 0.51856182 1000
## 2 2 nested_case lactate 1 lactate 0.01003264 1000
## adjvars adjvars.removed exposure.covariances adjspec outcome_uid
## 1 age_grp.2 age_grp.3 age_grp nested_case
## 2 age_grp.2 age_grp.3 age_grp nested_case
## outcome exposure_uid exposure adj_uid metabolite_name
## 1 nested_case HMDB00186 Alpha-Lactose age_grp.2 age_grp.3 lactose
## 2 nested_case HMDB00190 L-Lactic acid age_grp.2 age_grp.3 lactate
##
## $Effects
## run outcomespec exposurespec term estimate std.error statistic
## 1 1 nested_case lactose lactose 0.02268456 0.03513914 0.6455639
## 2 2 nested_case lactate lactate 0.57214513 0.22221799 2.5747022
## pvalue exp.estimate exp.std.error estimate.lower estimate.upper
## 1 0.51856182 1.022944 0.03594537 -0.04618689 0.09155601
## 2 0.01003264 1.772064 0.39378456 0.13660588 1.00768438
## exp.estimate.lower exp.estimate.upper metabolite_name
## 1 0.9548635 1.095878 lactose
## 2 1.1463763 2.739251 lactate
##
## $Errors_Warnings
## [1] type object message
## <0 rows> (or 0-length row.names)
##
## $Table1
## variable in.model type category n n.outcomeEqual0
## 1 nested_case outcome continuous 1000 502
## 2 age_grp adjustment categorical 1 271 142
## 3 2 565 280
## 4 3 164 80
## n.outcomeEqual1 n.unique min quartile1 median mean quartile3 max n.missing
## 1 498 2 0 0 0 0.498 1 1 0
## 2 129 NA NA NA NA NA NA NA NA
## 3 285 NA NA NA NA NA NA NA NA
## 4 84 NA NA NA NA NA NA NA NA
##
## $Info
## name
## 1 date
## 2 cohort
## 3 RcometsAnalytics version
## 4 R version
## 5 operating system
## 6 input file
## 7 model name
## 8 run type
## 9 op$check.cor.method
## 10 op$check.cor.cutoff
## 11 op$check.nsubjects
## 12 op$max.nstrata
## 13 op$model
## 14 op$output.Effects
## 15 op$output.ModelSummary
## 16 op$output.ci_alpha
## 17 op$output.metab.cols
## 18 op$output.type
## 19 op$output.merge
## 20 op$chemEnrich
## 21 op$chemEnrich.adjPvalue
## 22 op$max.npairwise
## 23 model.options$family
## 24 model.options$link
## 25 outcome
## 26 exposure
## 27 strata
## 28 exposurerefs
## value
## 1 2023-10-24 11:50:46.851151
## 2 DPP
## 3 2.9.0.13
## 4 R version 4.3.0 (2023-04-21)
## 5 Rocky Linux 8.7 (Green Obsidian)
## 6 /gpfs/gsfs10/users/wheelerwi/Rlibs/RcometsAnalytics/extdata/cometsInputAge.xlsx
## 7
## 8 Interactive
## 9 spearman
## 10 0.97
## 11 25
## 12 10
## 13 glm
## 14 exposure
## 15 anova
## 16 0.95
## 17 metabolite_name
## 18 xlsx
## 19 none
## 20 0
## 21 0.05
## 22 1000
## 23 binomial
## 24 logit
## 25 nested_case
## 26 *
## 27
## 28
##
## attr(,"ptime")
## [1] "Processing time: 0.325 sec"
## attr(,"class")
## [1] "runModel"
Call getModelData() to define a model which adjusts for age group, has n_visits as the outcome variable, and has lactose and lactate as the exposure variables. The variable n_visits must be a non-negative integer valued variable.
exmodeldata <- RcometsAnalytics::getModelData(exmetabdata,modelspec="Interactive", adjvars="age_grp",
outcomes="n_visits", exposures=c("lactose","lactate"))
To run a Poisson regression, the list of options op must also include a model.options list with family set to “poisson”.
op <- list(model="glm", model.options=list(family="poisson"))
poisson_results <- RcometsAnalytics::runModel(exmodeldata, exmetabdata, "DPP", op=op)
print(poisson_results)
## $ModelSummary
## run outcomespec exposurespec converged term wald.pvalue nobs message
## 1 1 n_visits lactose 1 lactose 0.6105400 1000
## 2 2 n_visits lactate 1 lactate 0.8271571 1000
## adjvars adjvars.removed exposure.covariances adjspec outcome_uid
## 1 age_grp.2 age_grp.3 age_grp n_visits
## 2 age_grp.2 age_grp.3 age_grp n_visits
## outcome exposure_uid exposure adj_uid metabolite_name
## 1 n_visits HMDB00186 Alpha-Lactose age_grp.2 age_grp.3 lactose
## 2 n_visits HMDB00190 L-Lactic acid age_grp.2 age_grp.3 lactate
##
## $Effects
## run outcomespec exposurespec term estimate std.error statistic
## 1 1 n_visits lactose lactose 0.00624383 0.01225956 0.5093028
## 2 2 n_visits lactate lactate 0.01679890 0.07693599 0.2183491
## pvalue estimate.lower estimate.upper metabolite_name
## 1 0.6105400 -0.01778447 0.03027213 lactose
## 2 0.8271571 -0.13399287 0.16759068 lactate
##
## $Errors_Warnings
## [1] type object message
## <0 rows> (or 0-length row.names)
##
## $Table1
## variable in.model type category n n.unique min quartile1 median
## 1 n_visits outcome continuous 1000 6 0 1 2
## 2 age_grp adjustment categorical 1 271 NA NA NA NA
## 3 2 565 NA NA NA NA
## 4 3 164 NA NA NA NA
## mean quartile3 max n.missing
## 1 2.037 3 5 0
## 2 NA NA NA NA
## 3 NA NA NA NA
## 4 NA NA NA NA
##
## $Info
## name
## 1 date
## 2 cohort
## 3 RcometsAnalytics version
## 4 R version
## 5 operating system
## 6 input file
## 7 model name
## 8 run type
## 9 op$check.cor.method
## 10 op$check.cor.cutoff
## 11 op$check.nsubjects
## 12 op$max.nstrata
## 13 op$model
## 14 op$output.Effects
## 15 op$output.ModelSummary
## 16 op$output.ci_alpha
## 17 op$output.metab.cols
## 18 op$output.type
## 19 op$output.merge
## 20 op$chemEnrich
## 21 op$chemEnrich.adjPvalue
## 22 op$max.npairwise
## 23 model.options$family
## 24 model.options$link
## 25 outcome
## 26 exposure
## 27 strata
## 28 exposurerefs
## value
## 1 2023-10-24 11:50:47.202151
## 2 DPP
## 3 2.9.0.13
## 4 R version 4.3.0 (2023-04-21)
## 5 Rocky Linux 8.7 (Green Obsidian)
## 6 /gpfs/gsfs10/users/wheelerwi/Rlibs/RcometsAnalytics/extdata/cometsInputAge.xlsx
## 7
## 8 Interactive
## 9 spearman
## 10 0.97
## 11 25
## 12 10
## 13 glm
## 14 exposure
## 15 anova
## 16 0.95
## 17 metabolite_name
## 18 xlsx
## 19 none
## 20 0
## 21 0.05
## 22 1000
## 23 poisson
## 24 log
## 25 n_visits
## 26 *
## 27
## 28
##
## attr(,"ptime")
## [1] "Processing time: 0.324 sec"
## attr(,"class")
## [1] "runModel"
Call getModelData() to define a model which adjusts for age group, has event as the outcome variable, time as the time-to-event variable, and has lactose and lactate as the exposure variables. The variable event must be binary, coded as 0 for non-events and 1 for events. The variable time must be positive.
exmodeldata <- RcometsAnalytics::getModelData(exmetabdata,modelspec="Interactive", adjvars="age_grp",
outcomes="event", timevar="time", exposures=c("lactose","lactate"))
To run a survival model, the list of options op must also include a model.options list with model set to “coxph”.
op <- list(model="coxph")
coxph_results <- RcometsAnalytics::runModel(exmodeldata, exmetabdata, "DPP", op=op)
print(coxph_results$ModelSummary)
## run outcomespec exposurespec term wald.pvalue nobs message
## 1 1 event lactose lactose 0.7526633 1000
## 2 2 event lactate lactate 0.6910693 1000
## adjvars adjvars.removed exposure.covariances adjspec outcome_uid
## 1 age_grp.2 age_grp.3 age_grp event
## 2 age_grp.2 age_grp.3 age_grp event
## outcome exposure_uid exposure adj_uid metabolite_name
## 1 event HMDB00186 Alpha-Lactose age_grp.2 age_grp.3 lactose
## 2 event HMDB00190 L-Lactic acid age_grp.2 age_grp.3 lactate
Call getModelData() to define a model which adjusts for age group, has nested_case as the outcome variable, matchedSet as the group variable, and has lactose and lactate as the exposure variables. The variable nested_case must be binary, coded as 0 for controls and 1 for cases. The variable matchedSet defines the matched sets of groups in the data.
exmodeldata <- RcometsAnalytics::getModelData(exmetabdata,modelspec="Interactive", adjvars="age_grp",
outcomes="nested_case", groupvar="matchedSet", exposures=c("lactose","lactate"))
To run a survival model, the list of options op must also include a model.options list with model set to “clogit”.
op <- list(model="clogit")
clogit_results <- RcometsAnalytics::runModel(exmodeldata, exmetabdata, "DPP", op=op)
print(clogit_results$ModelSummary)
## run outcomespec exposurespec term wald.pvalue nobs message
## 1 1 nested_case lactose lactose 0.51379179 1000
## 2 2 nested_case lactate lactate 0.01093298 1000
## adjvars adjvars.removed exposure.covariances adjspec outcome_uid
## 1 age_grp.2 age_grp.3 age_grp nested_case
## 2 age_grp.2 age_grp.3 age_grp nested_case
## outcome exposure_uid exposure adj_uid metabolite_name
## 1 nested_case HMDB00186 Alpha-Lactose age_grp.2 age_grp.3 lactose
## 2 nested_case HMDB00190 L-Lactic acid age_grp.2 age_grp.3 lactate
All models desginated in the input file can be run with one command, and individual output Excel files or correlation results will be written in the current directory by default. The function returns a list of objects.
allresults <- RcometsAnalytics::runAllModels(exmetabdata,writeTofile=TRUE)
sessionInfo()
## R version 4.3.0 (2023-04-21)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Rocky Linux 8.7 (Green Obsidian)
##
## Matrix products: default
## BLAS/LAPACK: /usr/local/intel/2022.1.2.146/mkl/2022.0.2/lib/intel64/libmkl_rt.so.2; LAPACK version 3.9.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] mnormt_2.1.1 pROC_1.18.4
## [3] gridExtra_2.3 readxl_1.4.3
## [5] rlang_1.1.1 magrittr_2.0.3
## [7] compiler_4.3.0 ISwR_2.0-8
## [9] vctrs_0.6.4 reshape2_1.4.4
## [11] stringr_1.5.0 pkgconfig_2.0.3
## [13] fastmap_1.1.1 backports_1.4.1
## [15] ellipsis_0.3.2 labeling_0.4.3
## [17] ca_0.71.1 utf8_1.2.3
## [19] rmarkdown_2.25 prodlim_2023.08.28
## [21] purrr_1.0.2 xfun_0.40
## [23] cachem_1.0.8 jsonlite_1.8.7
## [25] recipes_1.0.8 psych_2.3.9
## [27] broom_1.0.5 parallel_4.3.0
## [29] R6_2.5.1 bslib_0.5.1
## [31] stringi_1.7.12 RColorBrewer_1.1-3
## [33] RcometsAnalytics_2.9.0.14 parallelly_1.36.0
## [35] rpart_4.1.19 lubridate_1.9.3
## [37] jquerylib_0.1.4 cellranger_1.1.0
## [39] Rcpp_1.0.11 assertthat_0.2.1
## [41] iterators_1.0.14 knitr_1.44
## [43] future.apply_1.11.0 Matrix_1.6-1.1
## [45] splines_4.3.0 nnet_7.3-19
## [47] timechange_0.2.0 tidyselect_1.2.0
## [49] rstudioapi_0.15.0 yaml_2.3.7
## [51] viridis_0.6.4 TSP_1.2-4
## [53] timeDate_4022.108 codetools_0.2-19
## [55] listenv_0.9.0 lattice_0.21-8
## [57] tibble_3.2.1 subselect_0.15.5
## [59] plyr_1.8.9 withr_2.5.1
## [61] evaluate_0.22 future_1.33.0
## [63] survival_3.5-5 heatmaply_1.5.0
## [65] pillar_1.9.0 foreach_1.5.2
## [67] stats4_4.3.0 plotly_4.10.2
## [69] generics_0.1.3 ggplot2_3.4.4
## [71] munsell_0.5.0 scales_1.2.1
## [73] globals_0.16.2 class_7.3-22
## [75] glue_1.6.2 ppcor_1.1
## [77] lazyeval_0.2.2 tools_4.3.0
## [79] dendextend_1.17.1 data.table_1.14.8
## [81] ModelMetrics_1.2.2.2 gower_1.0.1
## [83] webshot_0.5.5 registry_0.5-1
## [85] grid_4.3.0 tidyr_1.3.0
## [87] crosstalk_1.2.0 seriation_1.5.1
## [89] ipred_0.9-14 colorspace_2.1-0
## [91] nlme_3.1-162 cli_3.6.1
## [93] fansi_1.0.5 viridisLite_0.4.2
## [95] lava_1.7.2.1 dplyr_1.1.3
## [97] corpcor_1.6.10 gtable_0.3.4
## [99] sass_0.4.7 digest_0.6.33
## [101] caret_6.0-94 htmlwidgets_1.6.2
## [103] farver_2.1.1 htmltools_0.5.6.1
## [105] lifecycle_1.0.3 hardhat_1.3.0
## [107] httr_1.4.7 MASS_7.3-60